#include <stdlib.h>
#include <string.h>
#include <stdio.h>

const char *txt0 = "(()(()()))";
const char *txt1 = "((()(()()))";

int pt, i, j, k;
int *a;

int main(){
    a = malloc(sizeof(int) * 50);
    pt = -1;
    for(i=0;i<strlen(txt1);i++){
        if(txt1[i] == '('){
            pt++;
        } else if(txt1[i] == ')' && pt < 0){
            printf("too much ')'");
            return 0;
        } else if(txt1[i] == ')' && pt >= 0){
            pt--;
        } else {

        }
    }
    if (pt >= 0){
        printf("too much '(' ");
        return 0;
    }
    printf("okk");
    return 0;
}